<#assign ctx=springMacroRequestContext.contextPath />
<!DOCTYPE html>
<html>
<head>
  <title>登录斯兔权限系统</title>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="${ctx}/common/layui/css/layui.css"/>
  <link rel="stylesheet" href="${ctx}/common/css/login.css" media="all">
  <style>
    body {
      background-image: url("common/images/bg_login2.svg");
      background-position: center 110px;
      background-repeat: no-repeat;
      background-size: 100%;
      background-color: #f0f2f5;
    }
    .login-header {
      color: rgba(0, 0, 0, .85) !important;
    }
    .login-footer {
      color: rgba(0, 0, 0, 0.7) !important;
    }
    .login-footer a {
      color: rgba(0, 0, 0, 0.7) !important;
    }
    .login-footer a:hover {
      color: rgba(0, 0, 0, 0.4) !important;
    }
  </style>
  <script>
      //if (window != top)
      //    top.location.replace(location.href);
  </script>
</head>
<body>
<div class="login-wrapper">
  <div class="login-header">
    <img src="common/images/logo.png">
  </div>
  <div class=" login-body">
    <div class="layui-card">
      <div class="layui-card-header">
        <i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;用户登录
      </div>
      <form class="layui-card-body layui-form layui-form-pane">
        <div class="layui-form-item">
          <label class="layui-form-label">账号</label>
          <div class="layui-input-block">
            <input name="username" type="text" lay-verify="required" class="layui-input" value="admin">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">密码</label>
          <div class="layui-input-block">
            <input name="password" type="password" lay-verify="required" class="layui-input" value="admin">
          </div>
        </div>
        <div class="layui-form-item" pane="">
          <label class="layui-form-label" lay-tips="7天内免登陆">记住我</label>
          <div class="layui-input-block">
            <input type="radio" name="remember" value="on" title="是">
            <input type="radio" name="remember" value="off" title="否" checked="">
          </div>
        </div>
        <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>-->
        <!--<div class="layui-input-block">-->
        <!--<div class="layui-row inline-block">-->
        <!--<div class="layui-col-xs7">-->
        <!--<input name="code" type="text" lay-verify="required" placeholder="验证码"-->
        <!--class="layui-input">-->
        <!--</div>-->
        <!--<div class="layui-col-xs5" style="padding-left: 10px;">-->
        <!--<img class="login-captcha" src="https://www.oschina.net/action/user/captcha">-->
        <!--</div>-->
        <!--</div>-->
        <!--</div>-->
        <!--</div>-->
        <div class="layui-form-item">
          <a href="javascript:;" class="layui-link">帐号注册</a>
          <a href="javascript:;" class="layui-link pull-right">忘记密码？</a>
        </div>
        <div class="layui-form-item">
          <button id="login-submit" type="button" class="layui-btn layui-btn-fluid">登 录</button>
        </div>
        <div class="layui-form-item login-other">
          <label>第三方登录</label>
          <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
          <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
          <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
        </div>
      </form>
    </div>
  </div>
  <div class="login-footer">
    <p>© 2019 <a href="https://www.stylefeng.cn" target="_blank">斯兔版权所有</a></p>
  </div>
</div>
<script type="text/javascript" src="common/plugins/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="common/layui/layui.js"></script>
<script type="text/javascript" src="common/js/map.js"></script>
<script>
    layui.use(['layer', 'form', 'jquery'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        // 表单提交
        //form.on('submit(login-submit)', function (obj) {
        //    return true;
        //});
        // 图形验证码
        // $('.login-captcha').click(function () {
        //     this.src = this.src + '?t=' + (new Date).getTime();
        //// });
        //var errorMsg = "${tips!}";
        //if (errorMsg) {
        //    layer.msg(errorMsg, {icon: 5, anim: 6});
        //}
        $("body").on("click", "#login-submit", function () { //删除
            var arrForm = $(".layui-form-pane").serializeArray();
            console.log(arrForm);
            $.ajax({
                async: true,//默认true为异步
                url: "login",
                type: "post",
                data: arrForm,
                dataType: "json",
                beforeSend: function (xhr) {
                },
                success: function (res, status, xhr) {
                    console.log(res);
                    if (res.code == 200) {
                        layer.msg('登录成功！正在跳转.....');
                        location.href="./";
                    } else {
                        layer.msg(res.msg);
                    }
                },
                error: function (xhr, status, error) {
                }
            });
        })
    });
</script>
</body>
</html>